//https://leetcode.cn/problems/reverse-linked-list/

struct ListNode* reverseList(struct ListNode* head) {

    if (head == NULL)
    {
        return NULL;
    }

    struct ListNode* n1, * n2, * n3;
    n1 = NULL;
    n2 = head;
    n3 = n2->next;

    while (n2)
    {
        //翻转
        n2->next = n1;

        //迭代
        n1 = n2;
        n2 = n3;
        if (n3)
            n3 = n3->next;
    }

    return n1;

}